<template>
    <div>
        <!-- 表格 -->
        <el-table v-loading="listLoading" :data="list" border style="width: 100%;margin-top: 10px;">
            <el-table-column label="序号" width="70" align="center">
                <template slot-scope="scope">
                    {{ (page - 1) * limit + scope.$index + 1 }}
                </template>
            </el-table-column>
            <el-table-column prop="title" label="模块名称" />
            <el-table-column prop="businessType" label="操作类型" />
            <el-table-column prop="method" label="请求方式" />
            <el-table-column prop="operName" label="操作人员" />
            <el-table-column prop="operIp" label="操作IP" />
            <el-table-column prop="status" label="状态" :formatter="formatStatus" />
            <el-table-column prop="createTime" label="创建时间" width="350" />
            <el-table-column label="操作" width="200" align="center">
                <template slot-scope="scope">
                    <el-button type="primary" icon="el-icon-edit" @click="info(scope.row)">详情</el-button>
                </template>
            </el-table-column>
        </el-table>
        <!-- 分页 -->
        <div class="block">
            <el-pagination background @current-change="currentChange" @size-change="sizeChange"
                :page-sizes="[5, 10, 15, 20]" :page-size="limit" layout="total, sizes, prev, pager, next, jumper"
                :total="total" style="padding: 30px 0; text-align: center;">
            </el-pagination>
        </div>
    </div>
</template>

<script>
import api from '@/api/system/sysLog/sys-oper-log'
export default {
    data() {
        return {
            list: [],
            total: 0,
            page: 1,
            limit: 5,
            listLoading: true,
            operLogVo: {}
        }
    },
    created() {
        this.operLogListPage();
    },
    methods: {
        // 格式化炸状态
        formatStatus(row, colum) {
            if (row.status === 1) {
                return '成功';
            } else {
                return '失败';
            }
        },
        // 详情
        info(row) {

        },
        //初始化数据
        operLogListPage() {
            api.operLogListPage(this.page, this.limit, this.operLogVo).then(res => {
                this.list = res.data.records
                this.total = res.data.total
                this.listLoading = false;
            })
        },
        // 分页参数变化
        sizeChange(size) {
            this.limit = size
            this.operLogListPage()
        },
        // 分页参数变化
        currentChange(current) {
            this.page = current;
            this.operLogListPage();
        },
    }
}
</script>

<style>

</style>